﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Nhanvien.aspx.cs" Inherits="Nhanvien" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>.:Danh sách nhân viên:.</title>
    <link href="../CSS/style.css" rel="stylesheet" type="text/css" />
        <script src="../JS/jscal2.js" type="text/javascript"></script>
    <link href="../css/jscal2.css" rel="stylesheet" type="text/css" />
    <link href="../css/border-radius.css" rel="stylesheet" type="text/css" />
    <script src="../JS/lang/vi.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table cellpadding="4" cellspacing="0" style="width: 100%; text-align: left;">
            <tr>
                <td class="head" colspan="4">
                    Cập nhật danh sách nhân viên</td>
            </tr>
            <tr>
                <td width="15%">
                    Mã nhân viên<asp:RequiredFieldValidator ID="RequiredFieldValidator7" 
                        runat="server" ControlToValidate="txtmanhanvien" Display="Dynamic" 
                        ErrorMessage="(*)" ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                <td width="35%">
                    <asp:TextBox ID="txtmanhanvien" runat="server" Width="95%"></asp:TextBox>
                </td>
                <td width="15%">
                    Họ tên<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ControlToValidate="txtten" Display="Dynamic" ErrorMessage="(*)" 
                        ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                <td width="35%">
                    <asp:TextBox ID="txtten" runat="server" Width="95%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Loại nhân viên</td>
                <td>
                    <asp:DropDownList ID="drdloainv" runat="server" DataSourceID="dsloainv" 
                        DataTextField="tenloainv" DataValueField="id_row">
                    </asp:DropDownList>
                </td>
                <td>
                    Ngày sinh<asp:RequiredFieldValidator ID="RequiredFieldValidator5" 
                        runat="server" ControlToValidate="txttendangnhap" Display="Dynamic" 
                        ErrorMessage="(*)" ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                <td>
                    <asp:TextBox ID="txtngaysinh" runat="server" Width="70%"></asp:TextBox>
                    <a id="Lnk_ngaysinh" class="icsl" href="javascript:;">&nbsp;</a>
                    <script type="text/javascript">
                        Calendar.setup({
                        inputField: "<%= txtngaysinh.ClientID %>",
                            dateFormat  : "%d/%m/%Y",
                            trigger: "Lnk_ngaysinh",
                            titleFormat : "%B, %Y",
                            onSelect   : function() { this.hide() }
                        });</script>
                </td>
            </tr>
            <tr>
                <td>
                    Số điện thoại&nbsp;
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="txtsodienthoai" 
                        ErrorMessage="bạn phải nhập dạng số trong khoảng [0-9]" 
                        ValidationExpression="([0-9])*" ValidationGroup="reg"></asp:RegularExpressionValidator>
&nbsp;</td>
                <td>
                    <asp:TextBox ID="txtsodienthoai" runat="server" Width="95%"></asp:TextBox>
                </td>
                <td>
                        Email<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                            ControlToValidate="txtemail" Display="Dynamic" ErrorMessage="(*)" 
                            ToolTip="Vui lòng nhập email" ValidationGroup="reg"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="txtemail" ErrorMessage="(*)" 
                            ToolTip="Vui lòng nhập đúng thông tin email" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                            ValidationGroup="reg"></asp:RegularExpressionValidator>
                </td>
                <td>
                    <asp:TextBox ID="txtemail" runat="server" Width="95%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Địa chỉ</td>
                <td>
                    <asp:TextBox ID="txtdiachi" runat="server" Width="95%"></asp:TextBox>
                </td>
                <td>
                        Tên đăng nhập<asp:RequiredFieldValidator ID="RequiredFieldValidator8" 
                        runat="server" ControlToValidate="txtngaysinh" Display="Dynamic" 
                        ErrorMessage="(*)" ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                <td>
                    <asp:TextBox ID="txttendangnhap" runat="server" Width="95%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                    <td>
                    Mât khẩu<asp:RequiredFieldValidator ID="rqmatkhau" 
                        runat="server" ControlToValidate="txtmatkhau" Display="Dynamic" 
                        ErrorMessage="(*)" ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                <td>
                    <asp:TextBox ID="txtmatkhau" runat="server" Width="95%" TextMode="Password" 
                        ontextchanged="txtmatkhau_TextChanged"></asp:TextBox>
                    </td>
                <td>
                    Nhập lại mật khẩu<asp:RequiredFieldValidator ID="rqnhaplaimatkhau" 
                        runat="server" ControlToValidate="txtnhaplaimatkhau" Display="Dynamic" 
                        ErrorMessage="(*)" ValidationGroup="reg"></asp:RequiredFieldValidator><asp:CompareValidator 
                        ID="CompareValidator1" runat="server" ControlToCompare="txtmatkhau" 
                        ControlToValidate="txtnhaplaimatkhau" ErrorMessage="(*)" 
                        ToolTip="Vui lòng nhập lại đúng thông tin mật khẩu" ValidationGroup="reg"></asp:CompareValidator></td>
                        <td>
                    <asp:TextBox ID="txtnhaplaimatkhau" runat="server" Width="95%" TextMode="Password"></asp:TextBox>
                        </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:Button ID="btnthem" runat="server" CssClass="ica" Text="Thêm" 
                        onclick="btnthem_Click" ValidationGroup="reg" />
                    <asp:Button ID="btnboqua" runat="server" CssClass="icc" Text="Bỏ qua" 
                        onclick="btnboqua_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="4" class="header">
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:GridView ID="grvds" runat="server" AutoGenerateColumns="False" 
                        DataSourceID="dsnhanvien" meta:resourcekey="grvdsResource1" Width="100%" 
                        EnableModelValidation="True">
                        <Columns>
                            <asp:TemplateField HeaderText="STT" meta:resourcekey="TemplateFieldResource1">
                                <ItemStyle HorizontalAlign="Center" Width="3%" />
                                <ItemTemplate>
                                    <%#Container.DataItemIndex+1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã NV">
                                <ItemTemplate>
                                    <asp:Label ID="lbmanv" runat="server" Text='<%# Eval("MaNV") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Họ tên" 
                                meta:resourcekey="TemplateFieldResource2">
                                <ItemTemplate>
                                    <asp:Label ID="lbten" runat="server" meta:resourcekey="lbtenResource1" 
                                        Text='<%# Eval("tennhanvien") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Ngày sinh">
                                <ItemTemplate>
                                    <asp:Label ID="lbngaysinh" runat="server" 
                                        Text='<%# Eval("ngaysinh", "{0:dd/MM/yyyy}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle Width="7%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Email">
                                <ItemTemplate>
                                    <asp:Label ID="lbemail" runat="server" Text='<%# Eval("email") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Số điện thoại">
                                <ItemTemplate>
                                    <asp:Label ID="lbsdt" runat="server" Text='<%# Eval("sodienthoai") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên đăng nhập">
                                <ItemTemplate>
                                    <asp:Label ID="lbtendn" runat="server" Text='<%# Eval("tendangnhap") %>'></asp:Label>
                                    <asp:Label ID="lbmatkhau" runat="server" Text='<%# Eval("matkhau") %>' 
                                        Visible="False"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Địa chỉ">
                                <ItemTemplate>
                                    <asp:Label ID="lbdiachi" runat="server" Text='<%# Eval("diachi") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Loại nhân viên">
                                <ItemTemplate>
                                    <asp:Label ID="lbloainv" runat="server" Text='<%# Eval("id_loainv") %>' 
                                        Visible="False"></asp:Label>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("tenloai") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField meta:resourcekey="TemplateFieldResource3">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgsua" runat="server" 
                                        CommandArgument='<%# Eval("id_row") %>' 
                                        ImageUrl="~/Images/Testing/pencil_16.png" 
                                        onclick="imgsua_Click" ToolTip="Sửa" />
                                    <asp:ImageButton ID="imgxoa" runat="server" 
                                        CommandArgument='<%# Eval("id_row") %>' 
                                        ImageUrl="~/Images/Testing/delete_16.png"
                                        onclick="imgxoa_Click" onclientclick="return confirm('Bạn có chắc muốn xóa?')" 
                                        ToolTip="Xóa" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" Width="7%" />
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <asp:SqlDataSource ID="dsnhanvien" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                        
                        SelectCommand="SELECT  Loainhanvien.tenloainv AS tenloai, Nhanvien.* FROM Loainhanvien INNER JOIN Nhanvien ON Loainhanvien.id_row = Nhanvien.id_loainv"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="dsloainv" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        SelectCommand="SELECT * FROM [Loainhanvien]"></asp:SqlDataSource>
                </td>
            </tr>
        </table>
    
    </div>
    <p>
    <asp:Label ID="lbid" runat="server" Visible="False"></asp:Label>
    </p>
    </form>
</body>
</html>
